package com.googlecode.milib.display {
	import com.googlecode.milib.actionControll.MLActionIniMidEnd;

	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;

	/**
	 * @author Marek Brun
	 */
	public class MCActionWithRemove extends MLActionIniMidEnd {

		protected var mc_parent:DisplayObjectContainer;
		
		private var _mc:MovieClip;
		
		public function MCActionWithRemove(mc:MovieClip) {
			_mc=mc;
			mc_parent=mc.parent;
			mc.gotoAndStop(1);
			mc_parent.removeChild(mc);
		}
		
		override protected function doStart():Boolean {
			if(super.doStart()){
				mc_parent.addChild(mc);
				return true;
			}
			return false;
		}
		
		override protected function doFinish():Boolean {
			if(super.doFinish()){
				mc_parent.removeChild(mc);
				return true;
			}
			return false;
		}
		
		public function get mc():MovieClip { return _mc; }
	}
}
